Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

int function for the "how_many" variable in line 24 #90

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nnnkkk9
Copy link

@nnnkkk9 nnnkkk9 commented May 18, 2020

I have tried the original code on Python 3.8.2 but it kept showing errors " 'str' object cannot be interpreted as an integer". While reading the traceback, I noticed in line 24, the variable "how_many" was acted as a string variable, not an integer one (I would love if someone explained to me why even though it was defined as an integer the function's argument). The only thing I did was to add int() to the "how_many" variable to convert it into an integer one. When I tested it back on my device, it worked like charm

I have tried the original code on Python 3.8.2 but it kept showing errors " 'str' object cannot be interpreted as an integer". While reading the traceback, I noticed in line 24, the variable "how_many" was acted as a string variable, not an integer one (I would love if someone explained to me why even though it was defined as an integer the function's argument). The only thing I did was to add int() to the "how_many" variable to convert it into an integer one. When I tested it back on my device, it worked like charm
@@ -21,7 +21,7 @@ def generate_fortune() -> str:
def generate_lucky_numbers(how_many: int) -> list:
Copy link
Collaborator

@annegentle annegentle Sep 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that the how_many : int in this line is what transforms how_many into an int so I'm surprised that it's necessary again in line 24. Did something change in the Python syntax perhaps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants